package com.tf.temper.entity;

/**
 * 
 *
 * @date 2020-09-15 09:52:39
 */
public class StatisticsReturnEntity<Entity>
{
	private int code;
	private String message;
	private int total;
	private Entity data;


	public StatisticsReturnEntity() {
		this.code = 200;
		this.total = 0;
		this.message = "Success";
	}

	public StatisticsReturnEntity(int code, String message) {
		this.code = code;
		this.message = message;
	}

	public StatisticsReturnEntity(Entity entity) {
		this();
		this.data = entity;
	}

	public StatisticsReturnEntity<Entity> ok(Entity entity) {
		this.data = entity;
		return this;
	}

	public StatisticsReturnEntity<Entity> ok(Entity entity,int total) {
		this.data = entity;
		this.total = total;
		return this;
	}

	public StatisticsReturnEntity<Entity> ok() {
		return this;
	}

	public StatisticsReturnEntity<Entity> error(String message) {
		return new StatisticsReturnEntity(500, message);
	}

	public StatisticsReturnEntity<Entity> errorLogic(String message) {
		return new StatisticsReturnEntity(404, message);
	}

	public StatisticsReturnEntity<Entity> put(Entity entity) {
		this.data = entity;
		return this;
	}

	public int getTotal() {
		return total;
	}

	public void setTotal(int total) {
		this.total = total;
	}

	public int getCode() {
		return this.code;
	}

	public String getMessage() {
		return this.message;
	}

	public Entity getData() {
		return this.data;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public void setData(Entity data) {
		this.data = data;
	}
}
